<div class="layui-fluid" id="VIEW-list-table" lay-title="用户列表" lig-title="customer-user-title">
    <div class="layui-btn-container nepadmin-pad-t10 nepadmin-pad-l10">
        <div class="layui-btn layui-btn-sm" lay-filter="lig-customer-user-add" lig-lang="btn-addAdmin">添加管理员</div>
    </div>
    <table lay-filter="lig-customer-user-table"></table>
</div>
<script type="text/html" id="tpl-customer-user-add">
    <form class="layui-form" lay-filter="lig-saveForm" style="padding: 20px 20px 0 0;">
        <input type="hidden" name="tenantId"/>
        <div class="layui-form-item">
            <label class="layui-form-label ligui-form-item-required" lig-lang="user-account">账号</label>
            <div class="layui-input-block">
                <input type="text" name="account" autocomplete="off" class="layui-input" lay-verify="required"
                        value=''>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label ligui-form-item-required" lig-lang="user-userName">用户名</label>
            <div class="layui-input-block">
                <input type="text" name="userName" autocomplete="off" class="layui-input" lay-verify="required"
                       value=''>
            </div>
        </div>
    </form>
</script>
<script>
    layui.use(['admin', 'table', 'form', 'laytpl', 'jquery', 'lig'], function (admin, table, form, laytpl, $, lig) {
        form.render();

        lig.table({
            elem: '[lay-filter="lig-customer-user-table"]',
            url: 'pd/customer/user/page?tenantId=' + parent.selectedTenantId,
            height: '',
            cols: [[
                {title: '', type: 'checkbox', fixed: true, width: 60},
                {title: '<span lig-lang="user-account">账号</span>', field: 'account', align: 'center', minWidth: 120},
                {title: '<span lig-lang="user-userName">用户名</span>', field: 'userName', align: 'center', minWidth: 120}
            ]]
        }, {
            mode: 'dialog',
            entity: 'customer-user',
            primaryField: 'userId',
            addContent: $('#tpl-customer-user-add').html(),
            addUrl: 'pd/customer/user/add',
            addTitle: '<span lig-lang="user-addAdmin">添加管理员</span>',
            area: ['30%', 'auto'],
            offset: 'auto',
            shade: 0.1,
            onAddOpened: function () {
                $('[lay-filter="lig-saveForm"] > input[name="tenantId"]').val(parent.selectedTenantId);
            }
        });
    })
</script>